
public class Main
{
	public static void main(String[] args)
        {
                Liczba l;
                int a = 0;
                for(int i = 1 ; i < args.length; i=i+2)
                {
                        if(args[i].compareTo("10")==0)
                        {
                                try
                                {
                                        a = Integer.parseInt(args[i-1]);
                                        l = new Liczba(a);
                                        for(int b = 2; b <= 16 ; b++)
                                        {
                                                System.out.println(l.zapis(b) + " " + b);
                                        }
                                }
                                catch(NumberFormatException ex)
                                {
                                        System.out.println("blad podczas konwersji");
                                        continue;
                                }
                                catch(LiczbaException ex)
                                {
                                        System.out.println(ex.getMessage());
                                }
                        }
                        else
                        {
                                try
                                {
                                        a = Integer.parseInt(args[i]);
                                        l = new Liczba(args[i-1], a);
                                        for(int b = 2; b <= 16 ; b++)
                                        {
                                                System.out.println(l.zapis(b) + " " + b);
                                        }
 
                                }
                                catch(NumberFormatException ex)
                                {
                                        System.out.println("Blad podczas konwersji podstawy");
                                        continue;
                                }
                                catch(LiczbaException ex)
                                {
                                        System.out.println(ex.getMessage());
                                }
                        }
                }
				if (args.length%2 != 0 && args.length > 0)
				{
					System.out.println(args[args.length-1] + " - nie podano podstawy");
				}
        }
	}